package com.itheima.kuozhan;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;

public class TestDemo {

    public static void main(String[] args) throws NoSuchMethodException {
        Class<Demo> clazz = Demo.class;
        Annotation[] annotations = clazz.getAnnotations();
        System.out.println(Arrays.toString(annotations));

        Annotation[] declaredAnnotations = clazz.getDeclaredAnnotations();
        System.out.println(Arrays.toString(declaredAnnotations));


        Deprecated annotation = clazz.getAnnotation(Deprecated.class);
        System.out.println(annotation);
        if(annotation!=null){
            System.out.println("这是一个过了时的类");
        }
        //判断指定的类上是否有指定类型的注解
        boolean flag = clazz.isAnnotationPresent(Deprecated.class);
        System.out.println(flag);
        Class<?>[] interfaces = clazz.getInterfaces();
        System.out.println(Arrays.toString(interfaces));
        System.out.println(clazz.getName());
    }
}
